/**
 * 
 */
package maggames.core;

import java.util.Random;

/**
 * Enum defining the various types of possible pieces used on the game board.
 * 
 * @author BenjaminPLee
 * @version 1.0
 */
public enum Piece {
	/**
	 * Denotes a location or action that did not use a game piece
	 */
	NONE,
	
	/**
	 * Denotes a piece common to both players
	 */
	COMMON,
	
	/**
	 * Denotes a piece belonging to Player 1
	 */
	P1,
	
	/**
	 * Denotes a "special" piece belonging to Player 1
	 */
	P1SPECIAL,
	
	/**
	 * Denotes a piece belonging to Player 2
	 */
	P2,
	
	/**
	 * Denotes a "special" piece belonging to Player 2
	 */
	P2SPECIAL;
	
	// TODO add promote method?
	
	/**
	 * Returns a randomly chosen Piece.
	 * 
	 * @return random Piece
	 */
	public static Piece getRandom() {
		Random rand = new Random();
		Piece [] pieces = Piece.values();
		int index = rand.nextInt(pieces.length);
		
		return pieces[index];
	}		
}
